package com.smart.village.big.screen.domain;

import com.alibaba.fastjson.JSONObject;

import java.io.Serializable;
import java.util.Iterator;

public class CaseInsensitiveJSON implements Serializable {
    private JSONObject jsonObject;

    public CaseInsensitiveJSON(String json) {
        this.jsonObject = JSONObject.parseObject(json);
    }

    public Object get(String key) {
        Iterator<String> keys = jsonObject.keySet().iterator();
        while (keys.hasNext()) {
            String currentKey = keys.next();
            if (currentKey.equalsIgnoreCase(key)) {
                return jsonObject.get(currentKey);
            }
        }
        return null;
    }

}
